package cn.hxzy.Controller;

import cn.hxzy.common.R;
import cn.hxzy.entity.User;
import cn.hxzy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/user")
public class UserController extends BaseController{

    @Autowired
    private UserService userService;

    @PostMapping("/register")
    public R register(@RequestBody User user){
        return userService.register(user);
    }

    @GetMapping("/login")
    public R login(@RequestParam("userName") String userName, @RequestParam("userPwd") String userPwd){
        return userService.login(userName,userPwd);
    }

    @GetMapping("/lookOrder")
    public R lookOrder(){
        String userName = claim.asString();
        return userService.lookOrder(userName);
    }

}
